#ifndef _USER_LOGIN_H_
#define _USER_LOGIN_H_

#include <mysql/mysql.h>
#include "func.h"
#include "threadPool.h"
#include "msgHandler.h"

#define LOGIN "login"
#define REGISTER "register"
#define LOGOFF "logoff"

#define RET_SUCCESS "success"
#define RET_FAIL "fail"

typedef struct user_s {
    char name[32];
    char passwd[256];
} user_t;

int user_login(const int netfd,user_t *puser,MYSQL *mysql);
int user_register(const int netfd,user_t *puser,MYSQL *mysql);
int user_logoff(const int netfd,user_t *puser,MYSQL *mysql);

int hand_login(const int netfd, train_t *ptrain, MYSQL *mysql, user_t *puser, int *flag);
#endif
